package com.summer.framework.admin.controller.rest;


//import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.summer.framework.api.feign.service.admin.TestApiService;
import com.summer.framework.common.entity.Users;
import com.summer.framework.admin.service.UserService;
import com.summer.framework.common.controller.BaseController;
import com.summer.framework.common.entity.response.BooleanResponse;
import com.summer.framework.common.entity.response.ObjectResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.*;
import com.summer.framework.api.feign.service.admin.UserApiService;

import javax.annotation.Resource;

/**
 * @auther: 杨杰
 * @date: 2018/12/24 16:15
 * @description:
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController extends BaseController<UserService, Users> {

    @Autowired
    private ConfigurableApplicationContext applicationContext;

    @Resource
    private UserService userService;

    @Resource
    private UserApiService userApiService;

    @Resource
    private TestApiService testApiService;

    @PostMapping("/test")
    public BooleanResponse test(@RequestBody Users user) {
        userService.test(user);
        return new BooleanResponse();
    }


    @GetMapping("/getUserByName/{userName}")
    public ObjectResponse<Users> user(@PathVariable String userName) {
        return new ObjectResponse<>(userService.getUserByName(userName));
    }

}
